const request = ({url,header={}, method = 'GET', data = {}}) => {
	console.log(import.meta.env);
	const baseUrl = import.meta.env.MODE=== 'development' ? 'http://localhost:3020' : 'http://localhost:3030'
	const token = uni.getStorageSync('token')
	const realHeader = token? {...header,token} : header
	return new Promise((resolve, reject) => {
		uni.request({
			url:baseUrl + url,
			header: realHeader,
			method,
			data,
			success(res) {
				if(res.statusCode === 200) {
					resolve(res.data.data)
				}
			}
		})
	})
}

export default request


// request({url: '/getHouse'}) // http://localhost:3020/getHouse